package cn.huangsm.advance.optimisticlock.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author huang
 * @PACKAGE_NAME cn.huangsm.advance.optimisticlock.config
 * @PROJECT_NAME advance-code
 * @date 2019/1/10
 */
@Configuration
@MapperScan("cn.huangsm.advance.optimisticlock.mapper")
public class MybatisPlusConfig {
    /**
     * 添加mybatisplus乐观锁插件
     * @return
     */
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor(){
        return new OptimisticLockerInterceptor();
    }

    /**
     * 分页插件
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor(){
        return new PaginationInterceptor();
    }
}
